package com.dalimao.corelibrary.view;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.TextView;

import com.dalimao.corelibrary.R;

public class LoadProgressDialog extends ProgressDialog {

    private TextView tvmsg;
    public LoadProgressDialog(Context context) {
        super(context);
    }

    public LoadProgressDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        init(getContext());
    }

    private void init(Context context) {
        setCanceledOnTouchOutside(false);

        setContentView(R.layout.load_dialog);
        tvmsg = (TextView) findViewById(R.id.tvmsg);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(params);
    }

    public void setTvmsg(String strtvmsg){
        tvmsg.setText(strtvmsg);
    }

    @Override
    public void show() {
        super.show();
    }

    @Override
    public void cancel() {
        super.cancel();
    }
}
